package com.sopragroup.dojo.webflow.booking;

import java.io.Serializable;
import java.util.Date;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;

import org.springframework.format.annotation.DateTimeFormat;

import com.sopragroup.dojo.webflow.person.Person;
import com.sopragroup.dojo.webflow.trip.Trip;

/**
 * Ajouter des validateurs sur cette classe
 * @see NotNull
 * @see DateTimeFormat
 * @see Valid pour valider les sous objets
 *
 */
public class BookingForm  implements Serializable  {
	/**
	 * 
	 */
	private static final long serialVersionUID = -1697061124641945928L;
	@Valid
	private Trip trip;
	@DateTimeFormat(pattern="dd/MM/yyyy")
	private Date date;
	@Valid
	private Person person = new Person();
	@Valid
	private Person guest;
	
	public Trip getTrip() {
		return trip;
	}
	public void setTrip(Trip trip) {
		this.trip = trip;
	}
	public Date getDate() {
		return date;
	}
	public void setDate(Date date) {
		this.date = date;
	}
	public Person getPerson() {
		return person;
	}
	public void setPerson(Person person) {
		this.person = person;
	}

	public Person getGuest() {
		return guest;
	}
	public void setGuest(Person guest) {
		this.guest = guest;
	}
	
	public Integer getSeats() {
		return guest == null ? 1 : 2;
	}
}
